package com.xtayfjpk.spring.security.test.servlet;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;

import com.xtayfjpk.spring.security.test.service.ACLService;

@Controller("aclServlet")
public class AclServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	//@Resource(name="myAclService")
	private ACLService aclService;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)	throws ServletException, IOException {
		Long id = Long.valueOf(req.getParameter("id"));
		aclService.addPermission(id);
		req.getRequestDispatcher("/acl.jsp").forward(req, resp);
	}
}
